<?php

namespace App\Transformers;

use App\Models\Level;
use League\Fractal\TransformerAbstract;

class LevelTransformer extends TransformerAbstract
{

    public function transform(Level $level)
    {

        return [
            'id' => $level->id,
            'level' => $level->level,
            'colour' => $level->colour,
            'count' => $level->fsUsers->count(),
            'created_at' => empty($level->created_at)?'':$level->created_at->toDateTimeString(),
            'updated_at' => empty($level->updated_at)?'':$level->updated_at->toDateTimeString(),
        ];
    }
}